#! /bin/bash
export LANG=en_US.UTF-8


pid=$?

jar_file=`ps aux|grep $pid|grep -v grep|grep -v zookeeper.properties|awk '{for(i=1;i<=NF;++i){if(index($i,".jar")>=1){print $i}}}'|awk -F ':' '{for(i=1;i<NF;++i){if(index($i,".jar")>1){if(index($i,"kafka")>=1){print $i}}}}'|head -1`
lib_path=`dirname $jar_file`
cd $lib_path/../

config_port=`sed  '/#listeners=/!d;s/.*=//' config/server.properties|tr -d '\r'|awk -F : '{print $NF}'|head -1`
if [ config_port ];then
  echo 9092
fi
